package org.ehe.business.ocr.domain;


import java.util.HashMap;
import java.util.Map;

/**
 * @author :zhangnn
 * @className :BusinessLicenseResult
 * @description: TODO
 * @date 2025-07-22 17:06:53
 */
public record OcrLicenseResult(
    String socialCreditCode,     // 社会信用代码
    String companyName,          // 单位名称
    String legalPerson,          // 法定代表人
    String address,              // 地址
    String establishDate,        // 成立日期
    String businessPeriod,       // 营业期限
    String businessScope,        // 经营范围
    String registeredCapital,    // 注册资本
    String certificateNumber,    // 证件编号
    String companyType           // 类型
) {
    /**
     * 将结果转换为Map
     */
    public Map<String, String> toMap() {
        Map<String, String> map = new HashMap<>();
        map.put("socialCreditCode", socialCreditCode);
        map.put("companyName", companyName);
        map.put("legalPerson", legalPerson);
        map.put("address", address);
        map.put("establishDate", establishDate);
        map.put("businessPeriod", businessPeriod);
        map.put("businessScope", businessScope);
        map.put("registeredCapital", registeredCapital);
        map.put("certificateNumber", certificateNumber);
        map.put("companyType", companyType);
        return map;
    }

    /**
     * 检查是否有识别到的内容
     */
    public boolean hasContent() {
        return !socialCreditCode.isEmpty() || !companyName.isEmpty() ||
            !legalPerson.isEmpty() || !address.isEmpty();
    }
}
